{
  "properties" : { },
  "id" : "f9c299135a4d4bfeba57350b16ce5d71",
  "script" : null,
  "groupId" : "0e4db7db28de4bbcad440c21a3c775e1",
  "name" : "当前实例",
  "createTime" : null,
  "updateTime" : 1741272952515,
  "lock" : null,
  "createBy" : null,
  "updateBy" : "可辉",
  "path" : "instance.svg",
  "method" : "GET",
  "parameters" : [ {
    "name" : "processInstanceId",
    "value" : "7aa08062-fa93-11ef-8b05-f4b3016ece8b",
    "description" : "任务的流程实例Id",
    "required" : true,
    "dataType" : "String",
    "type" : null,
    "defaultValue" : null,
    "validateType" : null,
    "error" : null,
    "expression" : null,
    "children" : null
  }, {
    "name" : "processDefinitionId",
    "value" : "UserReport:1:9cf06bad-fa89-11ef-8b05-f4b3016ece8b",
    "description" : "任务的流程定义Id",
    "required" : true,
    "dataType" : "String",
    "type" : null,
    "defaultValue" : null,
    "validateType" : null,
    "error" : null,
    "expression" : null,
    "children" : null
  } ],
  "options" : [ ],
  "requestBody" : "",
  "headers" : [ ],
  "paths" : [ ],
  "responseBody" : "{\n    \"code\": 500,\n    \"msg\": \"系统内部出现错误\"\n}",
  "description" : null,
  "requestBodyDefinition" : null,
  "responseBodyDefinition" : null
}
================================
import 'org.activiti.engine.RepositoryService' as repositoryService;
import 'org.activiti.engine.RuntimeService' as runtimeService;
import org.activiti.engine.repository.ProcessDefinition;
import org.activiti.image.impl.DefaultProcessDiagramGenerator;
import org.activiti.bpmn.model.BpmnModel;
import org.apache.commons.io.IOUtils;

import java.io.InputStream;
import response;

     ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
                        .processDefinitionId(processDefinitionId)
                        .singleResult();

    // 根据流程定义ID获取BPMN模型
    BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinitionId);

    InputStream bpmnStream;
    try {
        // 如果没有特别指定，这里不强调高亮显示任何节点
        bpmnStream = new DefaultProcessDiagramGenerator().generateDiagram(
                bpmnModel,
                runtimeService.getActiveActivityIds(processInstanceId),
                [],
                "宋体","宋体","宋体"
        );
    } catch(e) {
        exit 401, e.message
    }


return response.image(IOUtils.toByteArray(bpmnStream), 'image/svg+xml');